﻿Namespace Facades

    <EditableZone(IsFacade:=True)> _
    Public Class PieChartFacade
        Inherits XamChartFacade

        Dim _IsDoughnut As Boolean

        Public Overrides Sub AddSeries(ByVal target As Object)
            If brother.Series.Count > 0 Then Return

            Dim ser = New Infragistics.Windows.Chart.Series()
            ser.ChartType = Infragistics.Windows.Chart.ChartType.Pie
            ser.DataPoints.Add(1.5)
            ser.DataPoints.Add(1.7)
            ser.DataPoints.Add(1.3)


            brother.Series.Add(ser)
        End Sub

        <EditableProperty(Group:="Visual")> _
        Public Property IsDoughnut As Boolean
            Get
                Return _IsDoughnut
            End Get
            Set(ByVal value As Boolean)
                _IsDoughnut = value
                If brother.Series.Count = 0 Then Return

                brother.Series(0).ChartType = If(value, _
                        Infragistics.Windows.Chart.ChartType.Doughnut, _
                         Infragistics.Windows.Chart.ChartType.Pie)
            End Set
        End Property
    End Class
End Namespace
